package com.ruoyi.cms.controller.app;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.cms.domain.Banner;
import com.ruoyi.cms.service.IBannerService;

/**
 * App端Banner Controller
 *
 * @author ruoyi
 * @date 2025-01-05
 */
@RestController
@RequestMapping("/app/cms")
public class BannerAppController extends BaseController
{
    @Autowired
    private IBannerService bannerService;

    /**
     * 获取Banner列表（首页轮播图）
     */
    @GetMapping("/banners")
    public AjaxResult getBanners()
    {
        Banner query = new Banner();
        List<Banner> list = bannerService.selectBannerList(query);
        return success(list);
    }

    /**
     * 获取Banner详情
     */
    @GetMapping("/banner/{bannerId}")
    public AjaxResult getBanner(@PathVariable Long bannerId)
    {
        return success(bannerService.selectBannerByBannerId(bannerId));
    }
}
